<div *ngIf="!action.complete">
  <input *ngIf="!action.isLimited || action.limit.gte(2); else one"
         id="userNum"
         [(ngModel)]="action.userNum"
         (change)="action.reloadUserPrices()"
         type="number"
         placeholder="1"
         step="1"
         min="1"
         size="3">
  <ng-template #one>1</ng-template>
  <span>将会花费: </span>
  <app-price-line *ngFor="let price of action.prices; trackBy:getPriceId"
                  [unit]="price.base"
                  [canBuy]="price.userCanBuy"
                  [price]="price.priceUser"></app-price-line>
</div>

<div *ngIf="!action.complete"
     class="btn-group">
  <button *ngIf="!action.canBuy && !canSkip"
          class="btn btn-sm w-100"
          disabled>
    不能购买
    <span *ngIf="showTime">
      距离可以购买还差 {{action.availableIn | endIn}}
    </span>
  </button>
  <button *ngIf="!action.canBuy && skippable && showTime && canSkip"
          class="btn btn-primary btn-sm w-100"
          (click)="skip()">
    不能购买。 跳过 {{minuteSkip}} 分钟
  </button>
  <app-cant-buy-signposts *ngIf="showTime && !action.canBuy"
                          [action]="action"></app-cant-buy-signposts>
  <button *ngIf="action.canBuy"
          class="btn btn-sm w-100"
          (click)="buy(action.realNum)"
          [disabled]="!action.canUserBuy">
    购买
    <span *ngIf="!action.isLimited || action.limit.gte(2)">{{action.realNum | format: true}}</span>
  </button>
  <button *ngIf="action.maxBuy.gt(3)"
          class="btn btn-sm w-100"
          (click)="buy(action.maxBuy.div(2).floor())">
    购买 {{action.maxBuy.div(2).floor() | format: true}}
  </button>
  <button *ngIf="action.maxBuy.gte(2)"
          class="btn btn-sm w-100"
          (click)="buy(action.maxBuy)">
    购买 {{action.maxBuy | format: true}}
  </button>
</div>
